<?php
require_once ('../lib/config.php');
require_once ('../lib/friends.php');
require_once ('../lib/friend.php');
require_once ('../lib/test.php');
require_once ('../../simpletest/autorun.php');


class TestTemplate extends UnitTestCase {
    
//TestCase1 : Initialise an friend object
    function testConstructor1(){

        global $data_type_flags;

        try{
            $friend = new Friend("15720738", "Kyounghee Kwon");
            
            $result = $friend->getDataList();
            
            $this->assertEqual(count($result), count($data_type_flags));
            
            $this->assertEqual($friend->getNumberOfAllCommunications(), 0);           
            
            
            //Add data
//            $friend->addDatatype("FLAG");
            $datalist = $friend->getDataList();
//            $size = count($datalist);
//
//            $this->assertEqual($size, 1);
//            $this->assertEqual(0, $datalist["FLAG"]->getNumberOfData());
            
            //increase
            $datalist["ONEWAY_MESSAGE_FLAG"]->increase();
            
            $expected = 1;
            $result = $datalist["ONEWAY_MESSAGE_FLAG"]->getNumberOfData();
            
            $this->assertEqual($expected, $result);

        }catch(Exception $e){
            print_r($e);
            $this->assertFalse(true,"Unexpected Exception");
        }
    }

    function testConstructor2(){

        global $data_type_flags;

        $friend = new Friend("15720738", "Kyounghee Kwon", $data_type_flags);
        
        $datalist = $friend->getDataList();
        
        $expected = count($data_type_flags);
        $result = count($datalist);
        
        $this->assertEqual($expected, $result);
print_r($friend);

    }
    
    
}
?>
